package com.yuanian.timingwheel.model.task;

import com.yuanian.timingwheel.infrastructure.DateUtils;
import com.yuanian.timingwheel.model.task.base.BaseTask;

import java.util.Date;

/**
 * 固定时间的任务
 */
public class FixedDateTask extends BaseTask {

    protected Date executionDate;

    public FixedDateTask(String businessId, long executionInterval, long executionRounds, Date executionDate, String desc) {
        super(businessId, executionInterval, executionRounds, DateUtils.getNextSecond(executionDate), desc);
    }

    public FixedDateTask(String businessId, Date executionDate, String desc) {
        super(businessId, -1, 1, DateUtils.getNextSecond(executionDate), desc);
    }

    public FixedDateTask(String businessId, long executionInterval, String desc) {
        super(businessId, executionInterval, 1, DateUtils.getNextSecond(new Date()), desc);
    }

    public FixedDateTask(long executionInterval, long executionRounds, Date executionDate, String desc) {
        super(null, executionInterval, executionRounds, DateUtils.getNextSecond(executionDate), desc);
    }

    public FixedDateTask(Date executionDate, String desc) {
        super(null, -1, 1, DateUtils.getNextSecond(executionDate), desc);
    }

    public FixedDateTask(long executionInterval, String desc) {
        super(null, executionInterval, 1, DateUtils.getNextSecond(new Date()), desc);
    }

}
